// pywrapper.cpp: Boost.Python wrapper for the Maze C++ code
// Written by Victor Luna Freire - victorclf@live.com
// Copyright (c) Victor Luna Freire. All rights reserved.
// Sunday, November 01, 2009 7:19:49 PM

#include "boost/python.hpp"
#include "boost/python/suite/indexing/vector_indexing_suite.hpp" // std::vector wrapper

#include "shared.h"
#include "solver_dfs.h"
#include "builder_prim.h"

using namespace boost::python;

BOOST_PYTHON_MODULE(Mazeobjects)
{
	class_<Vec2i>("Point")
		.def(init<optional<int, int> >())
		.def_readwrite("x", &Vec2i::x)
		.def_readwrite("y", &Vec2i::y);

	class_< std::vector< Vec2i > >("vecPoint")
		.def(vector_indexing_suite< std::vector< Vec2i > >());

	class_< std::vector< std::string > >("vecStr")
		.def(vector_indexing_suite< std::vector< std::string > >());


	enum_<int>("Cell")
		.value("UNTOUCHED", UNTOUCHED)
		.value("FRONTIER", FRONTIER)
		.value("ADDED", ADDED)
		.value("IGNORED", IGNORED)
		.value("EXIT", EXIT);


	class_<BuilderPrim>("BuilderPrim", init<int, int>())
		.def("next_step", &BuilderPrim::next_step)
		.def("all_steps", &BuilderPrim::all_steps)
		.def("is_done", &BuilderPrim::is_done)
		.def("get_maze", &BuilderPrim::get_maze);
	
	class_<SolverDFS>("SolverDFS", init<const std::vector<std::string>&, const Vec2i&, const Vec2i&>())
		.def("next_step", &SolverDFS::next_step)
		.def("all_steps", &SolverDFS::all_steps)
		.def("is_done", &SolverDFS::is_done)
		.def("get_solution", &SolverDFS::get_solution)
		.def("get_maze", &SolverDFS::get_maze);
}